The attached patch fixes two problems I ran into with the swiotlb code
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 6 Sep 2005 18:25:00 +0000 (18:25 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 6 Sep 2005 18:25:00 +0000 (18:25 +0000)
commit65de2eefe961974ec8c8051d9a5574508bc6d4cf
tree565412d546f124e28ebe65cc29688cf29672ffb9
parentd22c0aa8355ab5938f99db111cde41e2731b3bca
The attached patch fixes two problems I ran into with the swiotlb code
in unstable (changeset aeaa3c83f6e5). Tested on a dual Opteron x86-64
machine with 4GB of memory and a tg3 modified to only DMA below 2GB.

- swiotlb_dma_supported() checked that the device DMA mask was equal
or bigger than 4GB, when in fact all that's needed is that the device
be able to DMA into the swiotlb aperture (1GB on my AMD x86-64
machine). Some device are actually only 31-bit DMA capable, so this
would've tripped them.

- On some platforms, PCI unmaps and syncs are nops, so there's no need to
keep track of the dma_addr they need after the initial mapping. The
DMA API supports this via the DECLARE_PCI_UNMAP_ADDR macros (see
Documentation/DMA-mapping.txt). Since the swiotlb code does make us of
the dma_addr for swiotlb_unmap_xxx and (more importantly)
swiotlb_dma_sync_xxx, we need to define them to something
meaningful.

Signed-Off-By: Muli Ben-Yehuda <mulix@mulix.org>
linux-2.6-xen-sparse/arch/xen/i386/kernel/swiotlb.c
linux-2.6-xen-sparse/include/asm-xen/asm-i386/pci.h
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pci.h